package com.hbmcc.heshenghuo.pager

import android.util.Log
import android.view.View

/**
 * @author 支豪亮
 * @date 2021/11/16 10:23 上午
 * @des 我的频道 个人、家庭、集团翻页展示的楼层的bean
 */
data class FloorMyFrgPagerBean(

    /**
     * 每一翻页的数据
     */
    var list: List<FloorMyFrgPagerItem>? = null

) {
    /**
     * 当前所在的页码
     */
    var pageIndex: Int = 0
}

/**
 * 每页的数据内容
 */
data class FloorMyFrgPagerItem(
    /**
     * 标题 个人、家庭、集团等
     */
    var title: String? = null,

    /**
     * 每一Gide的数据
     */
    var list: List<FloorMyGridItem>? = null,

    var data: FloorMyModelGroup? = null

) {
    /**
     * 当前选中Gide的数据
     */
    var gideIndex: Int = -1

    val tripVisibility: Int
        get() {
            if (gideIndex == -1) return View.GONE
            if (tripData == null) return View.INVISIBLE
            return View.VISIBLE
        }

    val tripData: FloorMyTripItem?
        get() {
            if (gideIndex == -1) return null
            val data: FloorMyGridItem = item(gideIndex) ?: return null
            return data.currentItem?.trip
        }

    fun item(pos: Int): FloorMyGridItem? {
        if (list.isNullOrEmpty()) return null
        if (pos < 0 || pos >= list!!.size) return null
        return list!![pos]
    }

    val isEmpty: Boolean
        get() = list.isNullOrEmpty()

    val isFour: Boolean
        get() {

            if (list.isNullOrEmpty()) return false
            if (list!!.size == 3) return false
            return true
        }

    var root:View? =null
}

/**
 * 每一个页每个Grid的数据,因为Grid支持翻转所以是List
 */
data class FloorMyGridItem(
    /**
     * 一个Gide展示的数据
     */
    var list: List<FloorMyModelItem>? = null

) {
    /**
     * 用于记录翻转当前的item
     */
    var flipIndex: Int = 0

    val currentItem: FloorMyModelItem?
        get() = item(flipIndex)

    var isStop:Boolean = false

    fun item(pos: Int): FloorMyModelItem? {
        if (list.isNullOrEmpty()) return null
        if (pos >= list!!.size) return null
        return list!![pos]
    }
}

/**
 *
 */
data class FloorMyModelItem(
    /**
     * 表示金额
     */
    var num: String = "--",

    /**
     * 表示单位
     */
    var unit: String = "",

    /**
     * 描述
     */
    var info: String = "",

    var trip: FloorMyTripItem? = null)

data class FloorMyTripItem(var tripIcon: String? = null,

    var tripTitle: String? = null,

    var tripMore: String? = null)

data class FloorMyModelGroup(var imgUrl: String? = null,

    var title: String? = null,

    var fuTitle: String? = null,

    var more: String? = null)